<template>
  <t-dialog :header="dialogInfo.header" :visible.sync="dialogInfo.visible" :onClose="closeDialog"
            :closeOnOverlayClick="false" :confirmBtn="null" width="90%" top="5%">
    <div style="height: 65vh">
      <t-form labelWidth="140px" :colon="true">
        <t-row style="align-items: stretch;">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="基本信息">
              <t-row style="align-items: stretch;">
                <t-col :span="12">
                  <t-form-item label="项目名称" name="projectName">
                    {{ data.projectName }}
                  </t-form-item>
                  <t-form-item label="申报日期" name="declareDate">
                    {{ data.declareDate }}
                  </t-form-item>
                  <t-form-item label="项目开始日期" name="systemId">
                    {{ data.startDate }}
                  </t-form-item>
                  <t-form-item label="项目结束日期" name="linkMan">
                    {{ data.endDate }}
                  </t-form-item>
                  <t-form-item label="主管单位名称" name="linkWay">
                    {{ data.manageDeptName }}
                  </t-form-item>
                  <t-form-item label="拟投入经费" name="linkWay">
                    {{ data.adviceFunding }}
                  </t-form-item>
                  <t-form-item label="关键词" name="linkWay">
                    {{ data.keyWord }}
                  </t-form-item>
                  <t-form-item label="项目状态" name="linkMan">
                    {{ data.projectStatus | filterByDict(dict.type.project_status) }}
                  </t-form-item>
                  <t-form-item label="申报单位" name="linkMan">
                    {{ data.declareDeptName  }}
                  </t-form-item>
                  <t-form-item label="项目负责人" name="linkMan">
                    {{ data.projectLeaderName  }}
                  </t-form-item>
                </t-col>
              </t-row>
            </t-card>
          </t-col>
        </t-row>
      </t-form>
    </div>
  </t-dialog>
</template>

<script>

import {getFiles} from "@/api/common";

export default {
  name: "project-manage-dialog",
  dicts:["formulate_type","standard_category","standard_property","prof_tit","sys_user_sex","education","project_status"],
  components: {
  },
  props: {
    dialogInfo: {
      type: Object,
      default() {
        return {
          id: "",
          header: "",
          visible: true
        }
      }
    },
  },
  data() {
    return {
      standardSystemOptions:[],
      value:"1",
      deptMenuOptions:[],
      tabValue:"1",
      profTitOptions:[],
      data: {
        draftUnits:[{}]
      },
    }
  },

  created() {
    this.getProfTitTreeSelect();
    this.getDetail();
    this.getDeptTreeSelect();
    this.getStandardSystemTree()
  },
  methods: {
    getStandardSystemTree(){
      return this.$api.bzh.standard.standardSystemTree().then(response => {
        this.standardSystemOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getProfTitTreeSelect() {
      return this.$api.system.profTit.treeselect().then(response => {
        this.profTitOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getDeptTreeSelect(){
      return this.$api.system.dept.treeSelectAllIn().then(response=>{
        this.deptMenuOptions = response.data
      }).catch(e=>{
        this.$message.error(e.toString())
      })
    },
    closeDialog() {
      this.$emit("closeBzhDialog", false);
      this.dialogInfo.visible = false
    },
    getDetail(){

      this.$api.bzh.standard.detailById(this.dialogInfo.id).then(response=>{
        this.data = response.data
        this.$api.bzh.standard.draftPerson(this.dialogInfo.id).then(response=>{
          this.data.draftPersons = response.data
        })
        this.$api.bzh.standard.draftUnit(this.dialogInfo.id).then(response=>{
          this.data.draftUnits = response.data
        })
      })
    },
  }
}
</script>

<style lang="less" scoped>
.card{
  margin-bottom: 14px;
}
.step-card{
  margin: 10px;
}
</style>
